import request from "./request"

//学员报名一对一
export class EditInfoApi {
    saveResource(path, type = 'image') {
        let data = {path, type}
        return request({url: '/api/v1/saveRes', method: 'post', data})
    }

    getCourseList() {
        return request({url: '/api/v1/org/getCourse', method: 'get'})
    }

    getStudyTimes() {
        return request({url: '/api/v1/org/getClassTime', method: 'get'})
    }

    //获取来源渠道下拉列表
    getChannelList() {
        return request({url: '/api/v1/org/getChannel', method: 'get'})
    }

    //获取称谓列表列表接口
    getAppellations() {
        return request({url: '/api/v1/org/getAppellations', method: 'get'})
    }

    registerStudent(params) {
        let {
            avatar, realname, id_card, main_name, phone, course, teacher,
            course_consultant, school, home_address, channel_id, class_date
        } = params
        let data = {
            type: 1, avatar, realname, id_card, main_name, phone, course, teacher, room_id: '',
            course_consultant, school, home_address, channel_id, class_date
        }
        return request({url: '/api/v1/org/subSignup', method: 'post', data})
    }
}

//学员报名-选择班级
export class SelectClassApi {
    getMajorList() {
        return request({url: '/api/v1/org/getMajor', method: 'get'})
    }

    getClassList(page, major) {
        let data = {page, search: '', major}
        return request({url: '/api/v1/class/room/list', method: 'post', data})
    }
}

//学员报名-选择班级-学生列表
export class ClassStudentListApi {
    getClassStudents(class_id) {
        let data = {class_id}
        return request({url: '/api/v1/class/room/student/list', method: 'post', data})
    }
}

//学员报名-选择班级-学生列表-学生详情
export class ClassStudentInfoApi {
    getStudentInfo({student_id, class_id}) {
        let data = {student_id, class_id}
        return request({url: '/api/v1/class/room/course/total', method: 'post', data})
    }
}

//学员报名-选择班级-创建班级
export class CreateClassApi {
    createClass({class_name, major_id, course_id, course_sku, teacher_id, start_time, maximum}) {
        let data = {class_name, major_id, course_id, course_sku, teacher_id, start_time, maximum}
        return request({url: '/api/v1/class/room/create', method: 'post', data})
    }

    getMajorList() {
        return request({url: '/api/v1/org/getMajor', method: 'get'})
    }

    getCourseList(page, major_id) {
        let data = {page, major_id}
        return request({url: '/api/v1/class/room/course/list', method: 'post', data})
    }

    getCourseDetail(course_id) {
        let data = {course_id}
        return request({url: '/api/v1/class/room/course/detail', method: 'post', data})
    }
}

//学员报名-选择班级-填写学员信息报名
export class InputClassStudentApi {
    saveResource(path, type = 'image') {
        let data = {path, type}
        return request({url: '/api/v1/saveRes', method: 'post', data})
    }

    getStudyTimes() {
        return request({url: '/api/v1/org/getClassTime', method: 'get'})
    }

    //获取来源渠道下拉列表
    getChannelList() {
        return request({url: '/api/v1/org/getChannel', method: 'get'})
    }

    //获取称谓列表列表接口
    getAppellations() {
        return request({url: '/api/v1/org/getAppellations', method: 'get'})
    }

    registerStudent(params) {
        let {
            avatar, realname, id_card, main_name, phone, course, teacher, room_id,
            class_date, time_id, class_num, free_class_num, course_consultant, school, home_address, channel_id
        } = params
        let data = {
            type: 2, avatar, realname, id_card, main_name, phone, course, teacher, room_id,
            class_date, time_id, class_num, free_class_num, course_consultant, school, home_address, channel_id
        }
        return request({url: '/api/v1/org/subSignup', method: 'post', data})
    }
}

//教师课表
export class SelectTeacherApi {
    getTeacherList() {
        return request({url: '/api/v1/org/getTeacherList', method: 'post'})
    }

    getTeacherSchedules({week, teacher_id}) {
        let data = {week, teacher_id}
        return request({url: '/api/v1/teacher/course/tables', method: 'post', data})
    }
}
